package com.ktgj.service.service.impl;

import java.util.List;
import com.ktgj.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktgj.service.mapper.ContractAttachmentMapper;
import com.ktgj.service.domain.ContractAttachment;
import com.ktgj.service.service.IContractAttachmentService;

/**
 * 合同附件Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-09-03
 */
@Service
public class ContractAttachmentServiceImpl implements IContractAttachmentService 
{
    @Autowired
    private ContractAttachmentMapper contractAttachmentMapper;

    /**
     * 查询合同附件
     * 
     * @param attachmentId 合同附件ID
     * @return 合同附件
     */
    @Override
    public ContractAttachment selectContractAttachmentById(Long attachmentId)
    {
        return contractAttachmentMapper.selectContractAttachmentById(attachmentId);
    }

    /**
     * 查询合同附件列表
     * 
     * @param contractAttachment 合同附件
     * @return 合同附件
     */
    @Override
    public List<ContractAttachment> selectContractAttachmentList(ContractAttachment contractAttachment)
    {
        return contractAttachmentMapper.selectContractAttachmentList(contractAttachment);
    }

    /**
     * 新增合同附件
     * 
     * @param contractAttachment 合同附件
     * @return 结果
     */
    @Override
    public int insertContractAttachment(ContractAttachment contractAttachment)
    {
        contractAttachment.setCreateTime(DateUtils.getNowDate());
        return contractAttachmentMapper.insertContractAttachment(contractAttachment);
    }

    /**
     * 修改合同附件
     * 
     * @param contractAttachment 合同附件
     * @return 结果
     */
    @Override
    public int updateContractAttachment(ContractAttachment contractAttachment)
    {
        contractAttachment.setUpdateTime(DateUtils.getNowDate());
        return contractAttachmentMapper.updateContractAttachment(contractAttachment);
    }

    /**
     * 批量删除合同附件
     * 
     * @param attachmentIds 需要删除的合同附件ID
     * @return 结果
     */
    @Override
    public int deleteContractAttachmentByIds(Long[] attachmentIds)
    {
        return contractAttachmentMapper.deleteContractAttachmentByIds(attachmentIds);
    }

    /**
     * 删除合同附件信息
     * 
     * @param attachmentId 合同附件ID
     * @return 结果
     */
    @Override
    public int deleteContractAttachmentById(Long attachmentId)
    {
        return contractAttachmentMapper.deleteContractAttachmentById(attachmentId);
    }
}
